home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Day Cry
/
Day Cry CD.bin
/
oh_towns
/
taropyon
/
silib
/
silib.lzh
/
PRG
/
SDKFS
/
FSELMENU.C
< prev
next >
Wrap
C/C++ Source or Header
|
1993-12-03
|
4KB
|
173 lines
/*************************************************************************
* âüâjâàü[
*************************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <silib.h>
#include <sipd.h>
#include <kbcode.h>
#include <sicoltbl.h>
#include <sifs.h>
#include "sdkfs.h"
#include "sdkfscf.h"
enum
{
_SORT_OFF,
_SORT_FILE,
_SORT_SUB,
_SORT_DATE,
_SORT_SIZE,
_BLK_1,
_SORT_NORMAL,
_SORT_REVERSE,
_BLK_2,
_DIR_TOP,
_DIR_BOTTOM,
_DIR_OFF,
_NUM,
};
static struct
{
int md;
CONST char *msg;
} menu[] =
{
{ 0, "Sort off" },
{ 0, "Sort filename" },
{ 0, "Sort sub name" },
{ 0, "Sort date&time" },
{ 0, "Sort file size" },
{ 0, NULL },
{ 0, "Normal" },
{ 0, "Reverse" },
{ 0, NULL },
{ 0, "Directory top" },
{ 0, "Directory last" },
{ 0, "Directory off" },
};
int FileSel_menu( FILESEL_T *fs )
{
int i, y;
int x1 = fs->frFl.x1 + 1;
int y1 = fs->frFl.y1 + 1;
int x2 = fs->frFl.x2 - 1;
int y2 = fs->frFl.y2 - 1;
LAYER_T *ly = SiScn->layerCrt;
EV_T *ev = NULL;
int evPos = 0;
POINT_T posMos = {-1,-1}, posCur = {0,0};
FRAME_T frSave = SiPd->fr;
void term(void)
{
PD_setMoveFr( &frSave );
if ( posMos.x >= 0 && posMos.y >=0 )
{
posMos.x += (SiEv->pdX - (x1 + posCur.x));
posMos.y += (SiEv->pdY - (y1 + posCur.y));
PD_setPos( &posMos );
}
if ( ev ) EV_workFree(ev);
};
/* â}âEâXê╩Æuò█æ╢ */
posMos.x = SiEv->pdX;
posMos.y = SiEv->pdY;
posCur.x = x2-x1 - 4;
posCur.y = 3;
{
POINT_T newPos;
newPos.x = x1 + posCur.x;
newPos.y = y1 + posCur.y;
PD_setPos( &newPos );
PD_setMoveFr( &(fs->frFl) );
}
if ( (ev = EV_workAlloc(NULL,_NUM+4)) == NULL )
{
term();
return (ERR);
}
menu[_SORT_OFF].md = ((fs->sort&0x0F) == FSSORT_OFF ? 0:1);
menu[_SORT_FILE].md = ((fs->sort&0x0F) == FSSORT_FILE ? 0:1);
menu[_SORT_SUB].md = ((fs->sort&0x0F) == FSSORT_SUB ? 0:1);
menu[_SORT_DATE].md = ((fs->sort&0x0F) == FSSORT_DATE ? 0:1);
menu[_SORT_SIZE].md = ((fs->sort&0x0F) == FSSORT_SIZE ? 0:1);
menu[_SORT_NORMAL].md = ((fs->sort&FSSORT_RVS) == 0 ? 0:1);
menu[_SORT_REVERSE].md = ((fs->sort&FSSORT_RVS) ? 0:1);
menu[_DIR_TOP].md = ((FS_ISSORT_DIRTOP(fs->sort)) ? 0:1);
menu[_DIR_BOTTOM].md = ((FS_ISSORT_DIRLAST(fs->sort)) ? 0:1);
menu[_DIR_OFF].md = ((FS_ISSORT_DIROFF(fs->sort)) ? 0:1);
MOS_DEC();
SCN_BOXF(x1,y1,x2,y2,PSET,ly->col.lgray);
y = y1;
for ( i = 0; i < _NUM; ++i )
{
SCN_BOXFCON(x1,y,x2,y+13,1,PSET,ly->col.gray,ly->col.white,ly->col.dark);
if( menu[i].msg )
{
COLOR_T col;
col = menu[i].md ? ly->col.black : ly->colTbl[8+2];
SCN_BOXFCON(x1+5-2,y+7-2,x1+5+2,y+7+2,1,PSET,col,ly->col.dark, ly->col.white);
SCN_PUTS(SiFts->ftsSs2,menu[i].msg,x1+12,y+1,OPAQUE,ly->col.black,ly->col.gray);
EV_SETBTN1(ev,evPos++, i, NULL, 0,
NULL, EVSW_LEFT,x1,y,x2,y+13,1,ly->col.white,ly->col.dark);
y += 14;
} else
y += 3;
}
EV_SETSWOLY(ev,evPos++,FSEV_EXIT,NULL,0,NULL, 0,EVSW_RIGHT);
EV_SETKON1( ev,evPos++,FSEV_EXIT,NULL,0,NULL,'\x1B',KA_CANCEL );
MOS_INC();
for(;;)
{
int ret;
MOS_CON();
ret = EV_chk(ev,0);
if ( ret >= 0 )
{
switch ( ret )
{
case _SORT_OFF: fs->sort = (fs->sort & 0xF0) | FSSORT_OFF; break;
case _SORT_FILE: fs->sort = (fs->sort & 0xF0) | FSSORT_FILE; break;
case _SORT_SUB: fs->sort = (fs->sort & 0xF0) | FSSORT_SUB; break;
case _SORT_DATE: fs->sort = (fs->sort & 0xF0) | FSSORT_DATE; break;
case _SORT_SIZE: fs->sort = (fs->sort & 0xF0) | FSSORT_SIZE; break;
case _SORT_NORMAL:
case _SORT_REVERSE: fs->sort ^= FSSORT_RVS; break;
case _DIR_TOP: fs->sort = (fs->sort & (~FSSORT_DIRBIT)) | FSSORT_DIRTOP; break;
case _DIR_BOTTOM: fs->sort = (fs->sort & (~FSSORT_DIRBIT)) | FSSORT_DIRLAST; break;
case _DIR_OFF: fs->sort = (fs->sort & (~FSSORT_DIRBIT)) | FSSORT_DIROFF; break;
}
if ( ret != FSEV_EXIT )
FileSel_sort( fs );
break;
}
}
MOS_DEC();
SCN_BOXF(x1,y1,x2,y2,PSET,ly->col.black);
MOS_INC();
term();
FileSel_dspFndat( fs, -1);
EV_waitMosSwOff();
return (NORMAL);
}